package cn.cubix.flow;

import org.flowable.engine.form.FormData;
import org.flowable.engine.form.StartFormData;
import org.flowable.engine.form.TaskFormData;
import org.flowable.engine.impl.RuntimeServiceImpl;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.ProcessEngine;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;


@Slf4j
public class WfTest1 extends BaseTest {

    @Autowired
    private RuntimeServiceImpl runtimeService;
    @Autowired
    private RepositoryService repositoryService;
    @Autowired
    private ProcessEngine processEngine;

    @Test
    public void test(){
        String processDefinitionId = "testFormProperty:3:1612108093527687168";
        String taskId = "1612117986242461698";
        // runtimeService.getFormInstanceById 取到的是StartEvent配置的表单
        FormData formData = runtimeService.getFormInstanceById(processDefinitionId);
        // processEngine.getFormService().getStartFormData 取到的是启动流程的表单
        StartFormData startFormData = processEngine.getFormService().getStartFormData(processDefinitionId);
        // processEngine.getFormService().getTaskFormData 取到的是任务的表单
        TaskFormData taskFormData = processEngine.getFormService().getTaskFormData(taskId);
        System.out.println("");
    }


}
